package com.zjeav.lingjiao.ui.home.persenter;

import android.support.annotation.NonNull;

import com.zjeav.lingjiao.base.baseBean.Result;
import com.zjeav.lingjiao.base.request.GetVersionRequest;
import com.zjeav.lingjiao.base.response.VersionResponse;
import com.zjeav.lingjiao.ui.home.model.GetVersionModel;
import com.zjeav.lingjiao.ui.home.model.SettingModel;
import com.zjeav.lingjiao.ui.home.view.GetVersionContract;
import com.zjeav.lingjiao.ui.home.view.SyssetContract;

public class GetVersionPersenter implements GetVersionContract.Presenter,GetVersionModel.OnGetVersionListener{

    private GetVersionModel module;
    private GetVersionContract.View view;

    public GetVersionPersenter(GetVersionContract.View view) {
        this.view = view;
        this.module = new GetVersionModel();
    }

    @Override
    public void getVersion(GetVersionRequest request) {
        this.module.getVersion(request,this);
    }

    @Override
    public void attachView(@NonNull GetVersionContract.View view) {
        this.view = view;
    }

    @Override
    public void detachView() {
        this.view = null;
    }

    @Override
    public void OnGetVersionSuccess(Result<VersionResponse> result) {
        this.view.showGetVersion(result);
    }

    @Override
    public void OnError(Throwable throwable) {
        this.view.ShowError(throwable);
    }
}
